#include <stdio.h>
int main()
{
    int i,n,max=0,index = 0,arr[200000]={0};
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&index);
        arr[index]++;
        if(max<=index)
            max = index;
    }
    for(i=0;i<=max;i++)
        if(arr[i] != 0)
            printf("%d %d\n",i,arr[i]);
    return 0;
}